package com.bookcode;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.util.ResourceUtils;

import java.io.File;

@SpringBootApplication
public class DemoApplication implements CommandLineRunner {
    //@Resource
    //FsShell fsShell;  // 用于执行hdfs shell命令的对象
    public void run(String... strings) throws Exception {
        // 查看根目录下的所有文件
       // for (FileStatus fileStatus : fsShell.ls("/")) {
        //    System.out.println("> " + fileStatus.getPath());
       // }
        File file = ResourceUtils.getFile("file:d:\\");
        if(file.exists()){
            File[] files = file.listFiles();
            if(files != null){
                for(File childFile:files){
                    System.out.println(">file:/"+childFile.getName());
                }
            }
        }

    }
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
